package com.andy.controller;

import com.andy.dao.entity.Resume;
import com.andy.service.ResumeService;
import com.sun.org.apache.bcel.internal.generic.RETURN;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/resume")
public class ResumoController {

    @Autowired
    private ResumeService resumeService;

    @RequestMapping("")
    public String toResumePage(){
        return "resume";
    }

    @RequestMapping("/list")
    @ResponseBody
    public List<Resume> getResumeAll(){
        List<Resume> resumeAll = resumeService.getResumeAll();
        return resumeAll;
    }

    @RequestMapping("/save")
    @ResponseBody
    public void saveResume(Resume resume){
        resumeService.saveResume(resume);
    }

    @RequestMapping("/delete")
    @ResponseBody
    public void saveResume(Long id){
        resumeService.deleteResume(id);
    }
}
